package website.haicheng.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import website.haicheng.api.entity.SysLogs;
import website.haicheng.core.config.IdService;
import website.haicheng.system.entity.Logs;
import website.haicheng.system.mapper.LogsMapper;
import website.haicheng.system.service.ILogsService;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 582895699@qq.com
 * @since 2021-02-09
 */
@Slf4j
@Service
public class LogsServiceImpl extends ServiceImpl<LogsMapper, Logs> implements ILogsService {

    @Autowired
    private LogsMapper logsMapper;

    @Autowired
    private IdService idService;

    @Override
    public void insertAccessLog(SysLogs logs) {
        Logs accessLog = new Logs();
        accessLog.setId(idService.nextId());
        BeanUtils.copyProperties(logs, accessLog);
        logsMapper.insert(accessLog);
    }
}
